Skip to content

feat: add grant update command - #25

Merged
aaearon merged 1 commit into
mainfrom
feat/update-command
Feb 19, 2026
Merged

feat: add grant update command#25
aaearon merged 1 commit into
mainfrom
feat/update-command

Conversation

@aaearon

@aaearon aaearon commented Feb 19, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds grant update subcommand that checks GitHub Releases for a newer version and replaces the current binary in-place using rhysd/go-github-selfupdate (already an indirect dep via the SDK — zero new modules)
  • Guards against dev builds with a clear error message
  • Follows existing DI pattern (selfUpdater interface, NewUpdateCommandWithDeps() factory, table-driven tests with mock)

Changes

File Purpose
cmd/interfaces.go selfUpdater interface
cmd/test_mocks.go mockSelfUpdater
cmd/update_test.go 9 tests (dev build, up-to-date, update, error, nil-release guard, v-prefix, slug, integration)
cmd/update.go Command implementation
cmd/commands.go Register NewUpdateCommand()
go.mod Promote blang/semver + rhysd/go-github-selfupdate to direct deps
CHANGELOG.md Unreleased entry
CLAUDE.md Add to command list

Test plan

  • make test — all existing + 9 new tests pass
  • make build VERSION=0.0.1 then ./grant update — detects newer release, updates binary
  • ./grant update again — reports "already up to date"
  • make build (dev) then ./grant update — errors with "cannot update a dev build"

Uses rhysd/go-github-selfupdate (already an indirect dep via the SDK)
to check for newer releases and replace the current binary in-place.
Guards against dev builds with an explicit error message.
@aaearon
aaearon merged commit fbd6308 into main Feb 19, 2026
1 check passed
@aaearon
aaearon deleted the feat/update-command branch February 19, 2026 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant